Skip to content

Use matching local FSharp.Core for regression builds#20072

Draft
majocha wants to merge 11 commits into
dotnet:mainfrom
majocha:use-matching-local-fsharp-core
Draft

Use matching local FSharp.Core for regression builds#20072
majocha wants to merge 11 commits into
dotnet:mainfrom
majocha:use-matching-local-fsharp-core

Conversation

@majocha

@majocha majocha commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR updates the local-compiler regression shim so it uses the locally built FSharp.Core in a way that matches the consuming project's target framework, instead of forcing a single global core choice.

What changed

  • Adjusted UseLocalCompiler.Directory.Build.props so the shim selects a matching local FSharp.Core asset based on the project target framework.
  • For older/legacy targets (for example .NET Framework and netstandard < 2.1), the shim uses the local netstandard2.0 FSharp.Core build.
  • For modern targets (for example net8.0/net10.0), the shim uses the local netstandard2.1 FSharp.Core build.
  • The shim now removes existing FSharp.Core references from the build graph and replaces them with the matching local assembly during assembly resolution, avoiding version conflicts with package-based FSharp.Core references.
  • The override is now idempotent, so the same local core path is not added twice and the build does not trip over duplicate reference entries.
  • If the matching local FSharp.Core artifact is missing, the build now fails loudly instead of silently falling back to the wrong assembly.

Why

The regression-test harness needs to test the locally built FSharp.Core, but it must do so in a way that is compatible with the project being built. The previous behavior could force the wrong FSharp.Core flavor for some projects and lead to build failures, assembly-version conflicts, or duplicate-reference issues.

Validation

I validated the new shim locally with two smoke builds:

dotnet build tests/projects/CompilerCompat/CompilerCompatLib/CompilerCompatLib.fsproj -c Release -p:LoadLocalFSharpBuild=True -p:TargetFramework=net8.0 -v:minimal

and a temporary repro project that explicitly references FSharp.Core 10.0.100 to mirror the CI failure mode:

dotnet build ShimRepro.fsproj -c Release -p:LoadLocalFSharpBuild=True -v:minimal

Both completed successfully without the FSharp.Core conflict or duplicate-reference issue seen in CI.

majocha and others added 4 commits July 21, 2026 23:11
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@majocha majocha changed the title Draft: use matching local FSharp.Core for regression builds Use matching local FSharp.Core for regression builds Jul 22, 2026
majocha and others added 6 commits July 22, 2026 09:24
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@majocha

majocha commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

It's an attempt to make #20065 work, but I don't like it at all. Made with the cheapest clanker available (MAI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants